{% extends "base.html" %}
{% load i18n imagequery_tags %}

{% block title %}{% trans "Galerie erstellen | fha-django-gallery" %}{% endblock %}

{% url gallery_detail slug=gallery.slug as gallery_detail %}
{% url gallery_edit slug=gallery.slug as gallery_edit %}

{% block breadcrumbs %}
    {% blocktrans with name=gallery.name %}
        Sie befinden sich hier: <a href="/">fha-django-gallery</a> &raquo; 
        <a href="/galerie/">Galerie</a> &raquo;
        <a href="{{ gallery_detail }}">{{ name }}</a> &raquo;
        <a href="{{ gallery_edit }}">Bearbeiten</a>
    {% endblocktrans %}
{% endblock %}

{% block content %}
    <h2>{% trans "Galerie bearbeiten" %}</h2>
    <form action="{% url gallery_edit slug=gallery.slug %}" method="POST" enctype="multipart/form-data">
        {% csrf_token %}
        {{ formset.management_form }}
        <ul class="gallery_edit">
        {% for form in formset %}
            <li id="item_{{ forloop.counter }}" class="item {% if form.empty_permitted %}empty {% endif %}{% if forloop.first %}first {% endif %}{% if forloop.last %}last {% endif %}">
                <div class="image">
                    <img src="{% image_format 'gallery_edit' form.instance.image %}" alt="" />
                </div>
                <div class="image-content">
                    <table cellspacing="0">
                        <tbody>
                            <tr>
                                <td colspan="2">{{ form.id }}</td>
                            </tr>
                            <tr>
                                <td>{{ form.content.label }}</td>
                                <td>{{ form.content }}</td>
                            </tr>
                            <tr>
                                <td>{{ form.tags.label }}</td>
                                <td>{{ form.tags }}</td>
                            </tr>
                            <tr>
                                <td>{{ form.DELETE.label }}</td>
                                <td>{{ form.DELETE }}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </li>
        {% endfor %}
        </ul>
        {% with "Speichern" as submit_text %}
            {% include "common/forms/display_form_submit.html" %}
        {% endwith %}
    </form>
{% endblock %}
